home *** CD-ROM | disk | FTP | other *** search
- Path: prodigy.com!usenet
- From: AXHM04A@prodigy.com (Brian Cahill)
- Newsgroups: comp.lang.c++
- Subject: HELP! Programming SOUND with TCWIN
- Date: 18 Apr 1996 03:39:13 GMT
- Organization: Prodigy Services Company 1-800-PRODIGY
- Distribution: world
- Message-ID: <4l4dh1$27bq@usenetw1.news.prodigy.com>
- NNTP-Posting-Host: innugap7-int.news.prodigy.com
- X-Newsreader: Version 1.2
-
- I'm trying to program my SoundBlaster 16 ASP for the first time. I have
- the Lamothe book on game programming, and it's got some source code
- examples written, I believe, in Microsoft C. However, I'm using Turbo
- C++ for Windows (TCWIN), and I'm having some difficulty using the _FP_SEG
- and _FP_OFF functions. Here are their declarations:
-
- unsigned _FP_SEG (void far *p);
- unsigned _FP_OFF (void far *p);
-
- The CTVOICE.DRV driver has to be loaded at a segment boundary (offset=0),
- or it acts funky. This is accomplished in the Lamothe book like this:
-
- int driver_handle;
- unsigned segment,num_para,bytes_read;
-
- // open the driver
-
- _dos_open("CT-VOICE.DRV", O_RDONLY, &driver_handle);
-
- // allocate the memory
-
- num_para = 1 + (filelength(driver_handle))/16;
-
- _dos_allocmem(num_para,&segment);
-
- // point driver pointer to data area
-
- _FP_SEG(driver_ptr) = segment; // PROBLEM STATEMENT
- _FP_OFF(driver_ptr) = 0; // PROBLEM STATEMENT
-
- // load in the driver code
-
- data_ptr = driver_ptr;
-
- do
- {
- _dos_read(driver_handle,data_ptr, 0x4000, &bytes_read);
- data_ptr += bytes_read;
-
- } while(bytes_read==0x4000);
-
- // close the file
-
- _dos_close(driver_handle);
-
- The two lines annotated with "PROBLEM STATEMENT" above are the ones that
- I'm having difficulty with. The TCWIN compiler gives me an "LVALUE
- REQUIRED" error on both lines. I've got no problem using _FP_SEG and
- _FP_OFF on the right hand side of statements, but on the right hand side
- they just don't compile for me with TCWIN.
-
- Any and all help/advice will be greatly appreciated!
- Thanks in advance,
- Brian
- <bcahill@prodigy.com>
-
-